home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / var / lib / dpkg / info / hdparm.preinst < prev    next >
Text File  |  2008-06-19  |  2KB  |  49 lines

  1. #!/bin/sh
  2.  
  3. # Remove a no-longer used conffile
  4. rm_conffile() {
  5.     CONFFILE="$1"
  6.  
  7.     if [ -e "$CONFFILE" ]; then
  8.         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  9.         old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
  10.         if [ "$md5sum" != "$old_md5sum" ]; then
  11.             echo "Obsolete conffile $CONFFILE has been modified by you."
  12.             echo "Saving as $CONFFILE.dpkg-bak ..."
  13.             mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
  14.         else
  15.             echo "Removing obsolete conffile $CONFFILE ..."
  16.             rm -f "$CONFFILE"
  17.         fi
  18.     fi
  19. }
  20.  
  21. if [ "$1" = install ] || [ "$1" = upgrade ]; then
  22.   if dpkg --compare-versions "$2" le 8.6-1ubuntu1; then
  23.       rm_conffile /etc/init.d/hdparm
  24.       update-rc.d -f hdparm remove >/dev/null 2>&1
  25.   fi
  26.  
  27.   if dpkg --compare-versions "$2" le 6.1-6; then
  28.     if dpkg --compare-versions "$2" gt 6.1-2; then
  29.       for conffile in /etc/init.d/hdparm.dev /etc/default/hdparm /etc/dev.d/block/hdparm.block /etc/dev.d/block/hdparm.dev; do
  30.         [ ! -e "$conffile" ] || rm_conffile "$conffile"
  31.       done
  32.     elif dpkg --compare-versions "$2" lt 5.5-5; then
  33.       update-rc.d -f hdparm remove > /dev/null 2>&1
  34.       if dpkg --compare-versions "$2" lt 5.4-6; then
  35.         [ ! -e /etc/hdparm.conf ] || rm_conffile "/etc/hdparm.conf"
  36.         if dpkg --compare-versions "$2" ge 5.4-3; then
  37.           if [ -e /etc/default/hdparm ]; then  
  38.             echo -n "Moving old /etc/default/hdparm to /etc/hdparm.conf . . "
  39.             mv /etc/default/hdparm /etc/hdparm.conf
  40.             echo "done."
  41.           fi
  42.         fi
  43.       fi
  44.     fi
  45.   fi
  46. fi
  47.  
  48.  
  49.